﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DeltaFlex.Data;
using System.Data;
using Taula = DeltaFlex.Negoci.ConsTaules.Preus;

namespace DeltaFlex.Negoci
{
    public class Preus
    {
        #region Variables
        private int _idPreu;
        private decimal _preu;
        private string _descPreu;
        #endregion

        #region Atributs
        public int IdPreu
        {
            get { return _idPreu; }
        }

        public decimal Preu
        {
            get { return _preu; }
            set { _preu = value; }
        }

        public string DescPreu
        {
            get { return _descPreu; }
            set { _descPreu = value; }
        }
        #endregion

        #region Mapeig
        public static Preus MapEntityFromDataReader(IDataReader record)
        {
            Preus preu = new Preus();

            MemberAllocation.Allocate(record, Taula.COLUMNA_IDPREU, ref preu._idPreu);
            MemberAllocation.Allocate(record, Taula.COLUMNA_PREU, ref preu._preu);
            MemberAllocation.Allocate(record, Taula.COLUMNA_DESCPREU, ref preu._descPreu);

            return preu;
        }
        #endregion
    }
}
